!init.
+!init : true
    <- 
	createWorkspace("kmsystemworkspace");
	joinWorkspace("kmsystemworkspace",_);
	!create_artifacts.

       
+!create_artifacts
      <-
	  makeArtifact("Iaar", "artifacts.IAARArt", [], IaarId);
	  focus(IaarId);
	  +artifact_Iaar(IaarId);
	  makeArtifact("HttpServer", "artifacts.HTTPServerArt", [], HttpId);
	  focus(HttpId);
	  +artifact_Http(HttpId);
	  makeArtifact("DBArtifact", "artifacts.DBSystemFile", [], DbId);
	  focus(DbId);
	  saveDocument("carlitos.pdf","contenido")[artifact_id(DbId)];
	  +artifact_Db(DbId).
	  //getDocument("adfafsd", "asd")[artifact_id(IaarId)].
	  
+newDocument(DOCUMENT, TYPE_OF_ACCESS): DOCUMENT > -1
	<- 
	?artifact_Iaar(IaarId);
	getDocument(DOCUMENT, TYPE_OF_ACCESS)[artifact_id(IaarId)].
	
+documentReady(DOCUMENT, TYPE_OF_ACCESS): DOCUMENT > -1
	<- 
	?artifact_Http(HttpId);
	.println("document Ready");
	makeDocument(DOCUMENT, TYPE_OF_ACCESS)[artifact_id(HttpId)].

+urlReady(Url): Url > -1
	<-
	.println(Url).
	
+storageDocument(Document_name,Document_content): Document_name > -1
	<-
	?artifact_Iaar(IaarId);
	storageDocument(Document_name, Document_content)[artifact_id(IaarId)].
	
+storageOK(Ok): Ok > -1
	<-
	.println("Storage OK: ",Ok).

+!create_artifact(ArtName, ArtType, Parameters)
   <- makeArtifact(ArtName, ArtType, Parameters, ArtId);
      focus(ArtId).
        //start("").
     
-!create_artifact(ArtName, ArtType, Parameters)[error_code(Code)]
   <- .print("Error creating artifact ", Code).
